package cn.nawang.ebeim.api.controller;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cn.nawang.ebeim.api.domain.StorageVersionTree;
import cn.nawang.ebeim.api.service.StorageVersionTreeService;
import cn.nawang.ebeim.api.utils.Constant;

/**
 * @ClassName: StorageVersionTreeController
 * @Description: TODO
 * @author fanyb
 * @date Aug 26, 2015 3:00:02 PM
 * @version v1.0
 */
@RestController
public class StorageVersionTreeController {

  private static final Logger LOG = LoggerFactory.getLogger(StorageVersionTreeController.class);

  @Autowired
  private StorageVersionTreeService storageVersionTreeService;

  /**
   * 
   * @author fanyb
   * @Description: 新增
   * @param storageVersionTree 对象
   * @return Map<String,Object>
   * @date Aug 26, 20154:55:45 PM
   *
   * @修改人
   * @修改日期
   */
  @RequestMapping(value = "/token/storage_version_tree/add", method = RequestMethod.GET)
  public Map<String, Object> add(StorageVersionTree storageVersionTree) {
    LOG.debug("/token/storage_version_tree/add {}", storageVersionTree);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("code", Constant.CODE_ERROR);
    boolean addFlag = storageVersionTreeService.add(storageVersionTree);
    if (addFlag) {
      map.put("code", Constant.CODE_SUCCESS);
      return map;
    }
    LOG.debug("add {}", map);
    return map;
  }
}
